/// Calculates the probability that at least two people share the same birthday
///
/// # Parameters
/// - `n` - The number of people
///
/// # Returns
/// Returns the probability as a floating-point number rounded to four decimal places
pub fn new_birthday_probability(n: u32) -> f64 {
    // If there are fewer than 2 people, the probability is 0
    if n < 2 {
        return 0.0;
    }

    let mut probability = 1.0;
    let days_in_year = 365.0;

    // Calculate the probability that no two people share a birthday
    for i in 0..n {
        probability *= (days_in_year - i as f64) / days_in_year;
    }

    // The probability that at least two people share a birthday
    let result = 1.0 - probability;

    // Round the result to four decimal places
    (result * 10000.0).round() / 10000.0
}
